package com.szalay.desktopsearch.ui;

import com.szalay.desktopsearch.search.SearchListener;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import org.apache.solr.client.solrj.response.QueryResponse;

/**
 * The status bar.
 * @author szalay
 */
public class StatusBar extends JLabel implements SearchListener {
    private static final long serialVersionUID = -7473870229895503240L;

    /** Create a new status bar. */
    public StatusBar() {
        super("Ready.");
        
        //Set a border
        setBorder(BorderFactory.createRaisedBevelBorder());
    }

    @Override
    public void searchFinished(QueryResponse response) {
        setText("Your search got " + response.getResults().getNumFound() + " results.");
        updateUI();
    }

    @Override
    public void searchStarting(String term) {
        setText("Searching " + term);
        updateUI();
    }
}
